Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Storage: Newtype for Database Volume/Content types #14885

Draft
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

MggMuggins
Copy link
Contributor

This:

  • Communicates intent via a variable's type, not just its name
  • Prevents accidental assignment of e.g. a volume type where a content type was expected
  • Enforces the type safety at the database boundary; any type IDs coming out of the database layer can be assumed to be correct
  • Provides convenient conversions using Name()

Enforce the type safety invariants for pool volume/content types as the
values are queried from the DB so that downstream code can assume that
their values are valid.

Signed-off-by: Wesley Hershberger <[email protected]>
Signed-off-by: Wesley Hershberger <[email protected]>
Signed-off-by: Wesley Hershberger <[email protected]>
Signed-off-by: Wesley Hershberger <[email protected]>
Signed-off-by: Wesley Hershberger <[email protected]>
Signed-off-by: Wesley Hershberger <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant